package com.lagou;

import org.springframework.stereotype.Component;

import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import java.util.Set;
@Component
public class MySpringServletContainerInitializer extends MyServlet implements ServletContainerInitializer {

    @Override
    public void onStartup(Set<Class<?>> set, ServletContext servletContext) throws ServletException {
        ServletRegistration.Dynamic dynamic =servletContext.addServlet("MyDispatcherServlet",getDispatcherServlet());
        dynamic.setLoadOnStartup(1);
        dynamic.addMapping("/app/*");

    }
}
